
package com.sm.shoplook.domain.system;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;

@Table(name = "t_system_role_menu")
public class RoleMenu implements Serializable {

	@Id
	private Integer id;
	/**
	 * 角色ID
	 */
	@Column(name = "role_code")
	private String roleCode;
	/**
	 * 菜单ID
	 */
	@Column(name = "menu_code")
	private String menuCode;
	private static final long serialVersionUID = 1L;

	/**
	 * @return id
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * @param id
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	public String getRoleCode() {
		return roleCode;
	}

	public void setRoleCode(String roleCode) {
		this.roleCode = roleCode;
	}

	public String getMenuCode() {
		return menuCode;
	}

	public void setMenuCode(String menuCode) {
		this.menuCode = menuCode;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(getClass().getSimpleName());
		sb.append(" [");
		sb.append("Hash = ").append(hashCode());
		sb.append(", id=").append(id);
		sb.append(", roleCode=").append(roleCode);
		sb.append(", menuCode=").append(menuCode);
		sb.append("]");
		return sb.toString();
	}

	@Override
	public boolean equals(Object that) {
		if (this == that) {
			return true;
		}
		if (that == null) {
			return false;
		}
		if (getClass() != that.getClass()) {
			return false;
		}
		RoleMenu other = (RoleMenu) that;
		return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
				&& (this.getRoleCode() == null ? other.getRoleCode() == null
						: this.getRoleCode().equals(other.getRoleCode()))
				&& (this.getMenuCode() == null ? other.getMenuCode() == null
						: this.getMenuCode().equals(other.getMenuCode()));
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
		result = prime * result + ((getRoleCode() == null) ? 0 : getRoleCode().hashCode());
		result = prime * result + ((getMenuCode() == null) ? 0 : getMenuCode().hashCode());
		return result;
	}
}
